package com.plusfoursix.game;

import android.view.MotionEvent;
import rokon.Handlers.InputHandler;

public class PlayerInputHandler extends InputHandler {

	Player player;
	
	public PlayerInputHandler(Player player) {
		this.player = player;
	}

	//	This is called every time there is a touch on screen, hotspot is true
	//	if an onHotspotTouched method is also triggered.
	public void onTouchEvent(MotionEvent event, boolean hotspot) {
		
		  if (event.getPressure() >= 0.01) {

		      if (event.getX() > Globals.SCREEN_WIDTH / 2) {
            	  player.setDirection(player.getSpeed());
        
              } else {
                  player.setDirection(-player.getSpeed());
              }
          } 
          else {
        	  player.setDirection(0);
          }
		
	}
}
